<?php
/**
 * FastApp.
 * 2/28/25
 * @Author 深色的海 (wx:deepsea_0024)
 * @Contact telegram:deepsea159
 */

use Hyperf\Database\Migrations\Migration;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Schema\Schema;

class CreateHoenixTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('hoenix_concubine', function (Blueprint $table) {
            $table->engine = 'Innodb';
            $table->comment('妃隐私表');
            $table->bigIncrements('id')->comment('主键');
            $table->timestamps();
            $table->tinyInteger('type')->comment('0散单1包养/长期')->default(0);
            $table->char('cup', 1)->nullable()->comment('罩杯');
            $table->tinyInteger('virgin')->comment('处0否1是')->default(0);
            $table->tinyInteger('oral_sex')->comment('口0否1是')->default(0);
            $table->tinyInteger('condom')->comment('套0否1是')->default(0);
            $table->tinyInteger('injection')->comment('内0否1是')->default(0);
            $table->tinyInteger('tattoo')->comment('文身0否1是')->default(0);
            $table->tinyInteger('cohabitation')->comment('同居0否1是')->default(0);
            $table->tinyInteger('make_love')->comment('过夜0否1是')->default(0);
            $table->tinyInteger('flyable')->comment('可飞0否1是')->default(0);
            $table->tinyInteger('other_places')->comment('外地0否1是')->default(0);
            $table->tinyInteger('sm')->comment('0否1是2轻微')->default(0);
            $table->tinyInteger('status')->comment('1接单2不接单3服务中')->default(0)->unsigned();
            $table->timestamp('certified_at')->comment('认证时间')->nullable();
            $table->string('accompany_day', 32)->comment('陪伴天数')->nullable();
            $table->decimal('wages', 11)->comment('工资')->default(0);
            $table->tinyInteger('wages_times')->comment('次数')->default(0)->unsigned();
            $table->bigInteger('view')->nullable()->unsigned()->default(0);
            $table->integer('sort')->nullable()->unsigned();
            $table->bigInteger('user_id')->nullable()->comment('用户id')->unsigned();
            $table->bigInteger('parent_id')->nullable()->unsigned();
            $table->string('nickname', 32)->nullable();
            $table->string('name', 32)->nullable();
            $table->date('birthday')->nullable();
            $table->smallInteger('height')->nullable()->comment('身高CM')->unsigned();
            $table->smallInteger('weight')->nullable()->comment('体重KG')->unsigned();
            $table->char('qualification', 32)->nullable()->comment('学历');
            $table->char('work', 32)->nullable()->comment('职业');
            $table->char('city', 64)->nullable()->comment('城市');
            $table->string('trigger_point')->nullable()->comment('雷点');
            $table->string('menstrual_period', 32)->nullable()->comment('经期');
            $table->string('reason')->nullable()->comment('原因');
            $table->string('on_duty', 16)->nullable()->comment('到岗');
            $table->string('self_intro')->nullable()->comment('介绍');
            $table->string('hope')->nullable()->comment('希望');
            $table->string('service')->nullable()->comment('服务内容');
            $table->string('remark')->nullable()->comment('备注');
            $table->json('image')->nullable();
            $table->json('video')->nullable();
            $table->json('imaget')->nullable();
            $table->json('videot')->nullable();
            $table->unique('user_id');
            $table->index('sort');
            $table->index('parent_id');
        });
        Schema::create('hoenix_concubine_keyword', function (Blueprint $table) {
            $table->engine = 'Innodb';
            $table->comment('关键词');
            $table->bigIncrements('id')->comment('主键');
            $table->bigInteger('concubine_id')->unsigned();
            $table->bigInteger('kid')->unsigned();
            $table->index('concubine_id');
            $table->index('kid');
        });
        Schema::create('hoenix_concubine_order', function (Blueprint $table) {
            $table->engine = 'Innodb';
            $table->comment('订单');
            $table->timestamps();
            $table->bigIncrements('id')->comment('主键');
            $table->bigInteger('user_id')->unsigned();
            $table->bigInteger('concubine_user_id')->default(0)->unsigned();
            $table->bigInteger('concubine_id')->default(0)->unsigned();
            $table->tinyInteger('accept')->comment('1是2否')->default(0)->unsigned();
            $table->tinyInteger('complete')->comment('完成0否1是2毁单')->default(0)->unsigned();
            $table->tinyInteger('rating')->comment('1-5心')->default(3)->unsigned();
            $table->text('content')->nullable()->comment('评价');
            $table->json('image')->nullable();
            $table->json('video')->nullable();
        });
        Schema::create('hoenix_black', function (Blueprint $table) {
            $table->engine = 'Innodb';
            $table->comment('黑名单');
            $table->bigIncrements('id')->comment('主键');
            $table->bigInteger('user_id')->unsigned();
            $table->char('device');
        });
        Schema::create('hoenix_index', function (Blueprint $table) {
            $table->engine = 'Innodb';
            $table->comment('索引');
            $table->timestamps();
            $table->bigIncrements('id')->comment('主键');
            $table->bigInteger('chat_id')->default(0);
            $table->tinyInteger('status')->unsigned()->default(1);
            $table->tinyInteger('type')->comment('0用户1群2频道3视频4音频5图片6文本7连接8网盘')->unsigned()->default(0);
            $table->bigInteger('sort')->unsigned()->default(0);
            $table->bigInteger('msg_id')->unsigned()->default(0);
            $table->timestamp('c_at')->nullable();
            $table->string('title', 128);
            $table->char('url', 128)->nullable();
            $table->char('username', 64)->nullable();
            $table->index('sort');
            $table->index('chat_id');
            $table->index('url');
        });
        Schema::create('hoenix_index_text', function (Blueprint $table) {
            $table->engine = 'Innodb';
            $table->comment('资源文本');
            $table->bigInteger('idx')->primary()->unsigned();
            $table->text('text')->nullable();
            $table->index('idx');
        });
        Schema::create('hoenix_keyword', function (Blueprint $table) {
            $table->engine = 'Innodb';
            $table->comment('搜索词');
            $table->bigIncrements('id')->comment('主键');
            $table->string('kw', 64);
            $table->integer('num')->comment('次数')->unsigned()->default(0);
            $table->index('kw');
        });
        Schema::create('hoenix_keyword_index', function (Blueprint $table) {
            $table->engine = 'Innodb';
            $table->comment('索引关联词');
            $table->bigIncrements('id')->comment('主键');
            $table->bigInteger('idx')->unsigned();
            $table->bigInteger('kid')->unsigned();
            $table->index('idx');
            $table->index('kid');
        });
        Schema::create('hoenix_index_ad', function (Blueprint $table) {
            $table->engine = 'Innodb';
            $table->comment('用户广告投放');
            $table->bigIncrements('id')->comment('主键');
            $table->bigInteger('idx')->unsigned();
            $table->bigInteger('shop_id')->unsigned();
            $table->index('idx');
            $table->index('shop_id');
        });
        Schema::create('hoenix_keyword_tg', function (Blueprint $table) {
            $table->engine = 'Innodb';
            $table->comment('用户搜索');
            $table->bigIncrements('id')->comment('主键');
            $table->bigInteger('kid')->unsigned();
            $table->bigInteger('tg_id')->unsigned();
            $table->index('tg_id');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('hoenix_concubine');
        Schema::dropIfExists('hoenix_concubine_keyword');
        Schema::dropIfExists('hoenix_concubine_order');
        Schema::dropIfExists('hoenix_black');
        Schema::dropIfExists('hoenix_index');
        Schema::dropIfExists('hoenix_index_text');
        Schema::dropIfExists('hoenix_keyword');
        Schema::dropIfExists('hoenix_keyword_index');
        Schema::dropIfExists('hoenix_index_ad');
        Schema::dropIfExists('hoenix_keyword_tg');
    }
}
